$.ajax({
    url: "http://chst.vip:1234/api/getcategorytitle",
})
    .then(res => {
        let info = '';
        res.result.forEach(item => {
            info += `
                    <div class="info">
                        <div class="title">
                            <p>${item.title}</p>
                            <a href="" class="clickNone" num="${item.titleId}">▼</a>
                        </div>
                        <div class="categoryNav">

                        </div>
                    </div>`
        });

        for (let i = 0; i < res.result.length; i++) {
            let count = res.result[i].titleId;
            let aNav = '';
            let url = `http://chst.vip:1234/api/getcategory?titleid=${count}`
            $.ajax({
                url: url,
            })
                .then(res => {
                    res.result.forEach(item => {
                        aNav += `<a href="bijia.html?title=${item.category}&categoryid=${item.categoryId}">${item.category}</a>`;
                    });

                    $('.categoryNav')[i].innerHTML = aNav
                })
        }
        $('#conttent')[0].innerHTML = info;

        for (let n = 0; n < res.result.length; n++) {
            $(`.categoryNav:eq(${n})`).hide();
            $(`.title:eq(${n})`).click(function (e) {
                e.preventDefault()
                for (let n = 0; n < res.result.length; n++) {
                    $(`.categoryNav:eq(${n})`).stop().slideUp(300)
                }
                $(`.categoryNav:eq(${n})`).stop().slideToggle(300)
            })
        }

    })


function getUrlParms(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return r[2]; return null;
}


$("#footer>.dengruSpan>.backTop").click(function () {
    $("html").animate({ scrollTop: 0 }, 1000)
})


